import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class test {
        @Autowired
        private JavaMailSender mailSender;
        @Test
        public void sendSimpleMail() throws Exception {
            SimpleMailMessage message = new SimpleMailMessage();
            message.setFrom("13781526625@163.com");
            message.setTo("1979768606@qq.com");
            message.setSubject("主题：简单邮件");
            message.setText("简单邮件内容");
            mailSender.send(message);
        }
    }


